package rpg.action;

import rpg.map.Creature;
import rpg.script.ConditionScriptImpl;
import square.data.ConditionData;
import square.data.DataGroup;

public class Condition extends Action {
	private ConditionData data, dataReflect;
	private ConditionScriptImpl script;

	// Creation
	public Condition(Creature creature, ConditionData data,
			ConditionData reflectData) {
		this.setCreature(creature);
		this.setData(data);
		this.setDataReflect(reflectData);

		if (this.getData().getScript() != null) {
			this.setScript((ConditionScriptImpl) this.getData().getScript()
					.instance());
			this.getScript().setCondition(this);
		}
	}

	public Condition(Creature creature, ConditionData data) {
		this(creature, data, data.instance());
	}

	public Condition(Creature creature, String name) {
		this(creature, DataGroup.findCondition(name));
	}

	// Get & Set
	public ConditionData getData() {
		return data;
	}

	public void setData(ConditionData data) {
		this.data = data;
	}

	public ConditionData getDataReflect() {
		return dataReflect;
	}

	public void setDataReflect(ConditionData dataReflect) {
		this.dataReflect = dataReflect;
	}

	public ConditionScriptImpl getScript() {
		return script;
	}

	public void setScript(ConditionScriptImpl script) {
		this.script = script;
	}
}